package com.woniu.guoguo.controller;


import com.woniu.guoguo.common.Result;
import com.woniu.guoguo.service.IMenuImgService;
import lombok.extern.slf4j.Slf4j;
import com.woniu.guoguo.controller.component.MenuInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Richie
 * @since 2020-11-03
 */
@RestController
@Slf4j
public class MenuImgController {

    @Autowired
    IMenuImgService iMenuImgService;

    @GetMapping("queryMenu")
    public Result queryMenu(){
        List<MenuInfo> menuInfos = iMenuImgService.queryMenu();
        return Result.success(menuInfos);
    }

    @GetMapping("querybuy")
    public Result querybuy(MenuInfo menuInfo, HttpSession httpSession){
        System.out.println(menuInfo.getMenuId());
        httpSession.setAttribute("menuId",menuInfo.getMenuId());
        return Result.success();
    }
    @GetMapping("querysort")
    public Result sortquery(String type, HttpSession httpSession){
        httpSession.setAttribute("menuType",type);
        return Result.success();
    }

}

